<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>       
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="${_resources}/logo.png"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">                                            
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />  
<title>系统管理员项目操作记录管理</title>
<%@ include file="/WEB-INF/jsp/common/inc.jsp" %>
<script type="text/javascript" src="${_resources}bootstrap/bootstrap-table.js"></script>
<link rel="stylesheet" href="${_resources}bootstrap/bootstrap-table.min.css" />
<script type="text/javascript" src="${_resources}jquery-ui/jquery-ui-1.10.4.custom.min.js"></script>
<link rel="stylesheet" href="${_resources}jquery-ui/jquery-ui-1.10.4.custom.min.css" />

<script type="text/javascript">
var adminProjectOperateRecord;
var userId ="${userId}";
var userName ="${userName}";
var isAdmin = "${isAdmin}";
//表单数据分页展示
function getTableData(editer,source){	
	adminProjectOperateRecord = $("#adminProjectOperateRecord").bootstrapTable({
		url : '${_baseUrl}/adminProjectOperateRecordController/getAdminProjectOperateRecordList',
		pagination: true,
		pageList: [5, 10, 20, 50],
  		queryParams: queryParams,
  		clickToSelect: false,
  		columns: [{
             field: 'id',
             title: 'id',
             visible:false,
         },{
             field: 'moduleName',
             title: '模块名称',
             width: 300/* ,
             formatter : function(value, row, index) {
            	var str="";
        		str +="<a onClick=\"fromDownload('"+row.id+"');\" title='"+value+"'  class=\"late_on_temp\">"+value+"</a>";  
				return str;
            } */
             
         }, {
             field: 'createUser',
             title: '创建人员ID',
             visible:false,
         },{
            field: 'projectName',
            title: '项目名称',
            width: 200
            
        },{
            field: 'operateType',
            title: '操作类型',
            width: 200,
            formatter: function(value, row, index){
            	var str = "";
            	if(value=="0"){
            		str = "删除";
            	}else if(value=="1"){
            		str = "修改"
            	}
                return str
            }
        },{
            field: 'createTime',
            title: '提交时间',
            width: 200
        },{
            title: '操作',
            width: 50,
            formatter: function(value, row, index){
                return "<a href='javascript:void(0)' id = '"+row.id+"' onclick=\"confirmOperate('"+row.id+"')\">确认</a>";
            }
        }]
    });
	
	function queryParams(params){
		return {
		    pageSize: params.limit,
		    pageNo: params.pn,
		    sort : params.sort,
		    order : params.order,
		    projectName: $("#keywords").val(),
		    operateType: "${operateType}"
	   }
	}
	
}

$(function(){	
	getTableData(true,true);
});

// 确认操作
function confirmOperate(id){
	$.ajax({
        url: '${_baseUrl}/adminProjectOperateRecordController/confirmProject',
        type: 'post', //数据发送方式
        dataType: 'json', //接受数据格式
        data:{
        	id :id
        },
        async: false,
        success: function (data) {
        	 if (data.code == '1') {
                 layer.msg("确认成功", {shift: 2, time: 2000}, function () {
                     
                	 refreshTable();
                 });
             }
             if (data.code == '0') {
                 layer.msg(data.message);
             }
        },
        error: function () {
            layer.msg("系统错误,请联系管理员");
        }
    });
};


function setHeight(){
	$("#popIframe").load(function(){
		var oObj = $(this).contents().find('body'),
			oAdd = $(this).contents().find('#add'),
			oEdit = $(this).contents().find('a'),
			oDia = $(this).contents().find('#popDiv');
		$(this).parent().css({'max-height':'500px','height':oObj.height()+40+'px'});
		oAdd.bind('click',function(){
			$('#popIframe',window.document.parent).parent().css({'max-height':'500px','height':'390px'});
		});

		oEdit.each(function(){
			if($(this).html() == '修改'){
				$(this).click(function(){
					$('#popIframe',window.document.parent).parent().css({'max-height':'500px','height':'390px'});
				})
			}
		})
	})
}

/* 关闭弹出框 */
function closeWin(){
	layer.closeAll();
}
function closeStyleTempDiv(){
	layer.close(layerIndex);
}

function refreshTable(){
	adminProjectOperateRecord.bootstrapTable('refresh');
}
//回车
$(document).keyup(function(event){
	  if(event.keyCode == 13){
		  selectList();
	  }
});

</script>
<style type="text/css">
.fixed-table-container{border:0px}
table{border:1px solid #ddd;margin-top: 7px!important;}
.fixed-table-header{height:0px}
</style>
</head>
<body>
<div class="submenu">
    <div class="func_bar">
    	<div class="search_container">
	        <div class="func_search">
	        	<div class="func_search_div"></div>
	            <input type="text" id="keywords" name="keywords" value="${keywords}" placeholder="请输入关键词" />
	            <a class="search_btn" onclick="refreshTable();" id="search" href="javascript:;"></a>
	        </div>
	    </div>
    </div>
    <div style="overflow: auto; width:98%;margin: auto;">
    	<table id="adminProjectOperateRecord" class="table table-bordered table_inline"></table>
	</div>
</div>
</body>
</html>